Fix upload-sarif Action failing if there are no Code Scanning SARIF files#3123
Merged
Fix upload-sarif Action failing if there are no Code Scanning SARIF files#3123
upload-sarif Action failing if there are no Code Scanning SARIF files#3123Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In #3064, we overlooked that
upload_lib.uploadFilesis called in theupload-sarifAction, which will fail if it cannot find any SARIF files matching the predicate it is given.For a Code Quality only analysis, there are no Code Scanning SARIF files and the call to
upload_lib.uploadFilestherefore fails before the Code Quality SARIF file(s) can be uploaded.This PR refactors the
upload-sarifAction so that there's common code for Code Scanning and Code Quality to upload either one file or several matching files.There are some optional, other changes in this PR as well, which I can remove if needed:
TheUploadStatusReportvalues for each SARIF upload are now combined for telemetry if both analysis kinds are enabled. Otherwise, we use the respectiveUploadStatusReport.sarif-idsoutput to theupload-sarifAction, which contains a stringified JSON object with details of the SARIF ids that we uploaded to different endpoints. Initially I went for just a comma-separated list of IDs, but I thought it would be useful to know which ID is for which service.Risk assessment
For internal use only. Please select the risk level of this change:
Merge / deployment checklist